<style>

</style>
<?php $html->css('/assets/css/gallery.css',null,array(),false);?>		
<?php 
	$loop = 1;
	foreach($dealAssets as $dealAsset)
	{ ?>
		<div class="galleryImage" style="clear: none;margin-top: 10px;">
			<?php 
			echo $asset->previewImage($dealAsset['DealAsset'],array('thumb'=>array('width'=>'60','height'=>'60','crop'=>false)));
			if(!isset($allowDefaultSelect) || $allowDefaultSelect == true)
			{						
				echo '<br />'.$form->input("DealAsset.is_default",array('title'=>__("Set as default image"),'style'=>"marging-left:3px;","type"=>'radio','checked'=>$dealAsset['DealAsset']['is_default'] ? 1:"",'options'=>array($dealAsset['DealAsset']['id']=>""),'value'=>1,'div'=>false,'legend'=>false,'label'=>false,'div'=>false));
			}
			echo $html->link("",array("plugin"=>"deals","controller"=>"deal_assets",'action'=>"delete",$dealAsset['DealAsset']['id']),array('style'=>"padding-top:0px !important","class"=>"delete_link crossIcon",'onclick'=>"return confirmAndAjaxCall(this,'".__("Are you sure you want to delete this image?")."')"));
			?>
		</div>
		<?php 
		if($loop%3 == 0)
		{
			echo '<div class="clear"></div>';
		}
		$loop++;
	}
	?>
<script>
	function confirmAndAjaxCall(caller,msg)
	{
		if(confirm(msg))
		{
			var fn = function() {
				if(typeof countCheck == "function")
				{
					countCheck.call($('#asset_inputs_parent_field_add_more').parent()[0]);
				}
			};
			$.get($(caller).attr("href"));
			$(caller).closest(".galleryImage").hide('slow',function(){
				$(this).remove();
				fn();
			});
			setTimeout(fn,200);
		}
		return false;
	}
</script>